import { MenuItem } from '../../../store';
import { ApiMenuList } from './Type';

export const getMenuList = (data: ApiMenuList): Promise<MenuItem[]> => {
    // return request.post(PORT1 + '/menu', data);
    console.log(data);

    return new Promise((resolve) => {
        setTimeout(() => {
            resolve([
                {
                    key: 'home',
                    label: '首页',
                    path: '/home',
                },
                {
                    key: 'error',
                    label: '错误页面',
                    children: [
                        {
                            key: '403',
                            label: '403页面',
                            path: '/403',
                        },
                        {
                            key: '404',
                            label: '404页面',
                            path: '/404',
                        },
                        {
                            key: '500',
                            label: '500页面',
                            path: '/500',
                        },
                    ],
                },
            ]);
        }, 1000);
    });
};

export const getRouterList = (data: ApiMenuList): Promise<string[]> => {
    // return request.post(PORT1 + '/menu', data);
    console.log(data);

    return new Promise((resolve) => {
        setTimeout(() => {
            resolve(['/home', '/404', '/403', '/500']);
        }, 1000);
    });
};
